<?php

namespace App\Http\Controllers\Wechat\Upload;

use Laravel\Lumen\Routing\Controller as BaseController;
use EasyWeChat\Foundation\Application;


/**
 * 上传素材到微信服务器
 * Class UploadMaterialController
 * @package App\Http\Controllers\Wechat\Upload
 */
class UploadMaterialController extends BaseController
{
    private $app;
    // 永久素材
    private $material;
    // 临时素材
    private $temporary;

    /**
     * UploadMaterialController constructor.
     * @param null $app
     */
    public function __construct()
    {
        $this->app       = new Application( config( 'wechat' ) );
        $this->material  = $this->app->material;
        $this->temporary = $this->app->material_temporary;
    }

    public function image()
    {
        $path   = '/data/wwwroot/dlpu.xu42.cn/public/assets/img/dlpu_calendar_20162017.png';
        $result = $this->material->uploadImage( $path );
        var_dump( $result );
    }

}
